CS 180 Programming Project 4A
Image Rectification
To rectify an image, we first need to calculate the transformation matrix of the corresponding points (manually selected pairs). The H matrix will transform the coordinates x and y into (xw, yw, w). After utilizing the normalization, we can get a transformed perspective.
To retrieve the H matrix, we uses the least-square approach to calculate the estimation. In addition, we also modified the wrapping function from Project 3 to perform the sampling in the target image space from the source image. The key difference is that we need to avoid sampling if the corresponding point lies outside the source image domain.
Tennis Court (picture is taken by myself)

Rectified Version of Tennis Court

Tennis Court 2 (picture from the internet)

Rectified Version of Tennis Court 2

We can see that because the first image was taken from a stronger perspective, the edges appear slightly blurry. However, the rectification generally makes sense.
Blend the images into a Mosaic
In this part, we use one picture as the target image and transform the other images to match the perspective of the target. Additionally, we add padding to the canvas for better results.
Image 1:



Image 2:



Image 3: